package com.jinmdz.fmis.api.api.controller;

import com.jinmdz.fmis.api.admin.model.admin.SystemCodeData;
import com.jinmdz.fmis.api.admin.model.admin.VueMenuComponentItem;
import com.jinmdz.fmis.api.admin.service.AdminService;
import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * 菜单管理相关接口
 *
 * @author LiCongLu
 * @date 2019-12-31 08:44
 */
@Api(description = "菜单管理相关接口")
@RestController()
@RequestMapping("/api/menu")
public class MenuController extends BaseController {

    @Resource
    private AdminService adminService;

    /**
     * 根据用户权限加载指定系统的菜单（正式数据）
     *
     * @param data 系统编码
     * @return
     * @author LiCongLu
     * @date 2020-03-24 16:54
     */
    @ApiOperation(value = "根据用户权限加载指定系统的菜单（正式数据）", notes = "根据当前登录用户权限加载指定系统菜单")
    @PostMapping("/load-sys-menu-with-system-code")
    public BaseResult<ArrayList<VueMenuComponentItem>> loadSysMenuWithSystemCode(@RequestBody SystemCodeData data) {
        return resultHandler(userItem -> adminService.loadSysMenuWithSystemCode(userItem, data));
    }
}
